#include<iostream>
#include<math.h>
using namespace std;

typedef struct Tnode{
	int x;
	Tnode *left;
	Tnode *right;
}Tnode;

typedef Tnode *Tree;

void CreateTree(Tree &);
Tnode *CreateTNode (int );
void AddTNode (Tree &, int);
void AddTNode(Tree &, Tnode *);
void SearchTnode (Tree , Tnode *);
void PrintTree (Tree T);
int SearchKey (Tree, int key);
int CountTNode(Tnode *);
void TreeHeight(int );

int CountLeaf(Tnode*);
int CountLeaf1(Tnode*);

int CheckPrimeNum(int);
int SumPrimeNum(Tnode*);

int CheckSquareNum(int );
int SumSquareNum(Tnode *);
void DeleteTNode (Tree &, int );
Tnode* Swap1(Tnode *, Tnode *);
void Swap2(Tnode *&, Tnode *&);
int CheckBranch(Tnode *, int);